package com.lboyang.seckill.rabbitmq;

import com.lboyang.seckill.entity.SeckillMessage;
import com.lboyang.seckill.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @Description:
 * @Author: Aiguodala
 * @CreateDate: 2021/5/30 11:18
 */
@Service
@Slf4j
public class MQProvider {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Autowired
    private RedisTemplate redisTemplate;


    /**
     * 发送秒杀信息
     * @param message
     */
    public void sendSeckillMessage(String message) {
        log.info("发送信息" + message);
        rabbitTemplate.convertAndSend("seckillExchange", "seckill.message", message);
    }


}
